package com.gitee.neuray.security.mail.rpc;

import com.gitee.neuray.security.common.msg.ObjectRestResponse;
import com.gitee.neuray.security.mail.biz.MailReminderBiz;
import com.gitee.neuray.security.mail.feign.WBMailServiceFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api")
public class MailReminderRest implements WBMailServiceFeignClient {

    @Autowired
    private MailReminderBiz mailReminderBiz;

    @Override
    @RequestMapping(value="/mail/firstApproverStart",method = RequestMethod.POST)
    public ObjectRestResponse firstApproverStart(){
        try {

            mailReminderBiz.firstApproverStart();
        } catch (Exception e) {
            e.printStackTrace();
            return  new ObjectRestResponse().rel(true).msg("500").data("添加失败");
        }
        return  new ObjectRestResponse().rel(true).msg("200").data("添加成功");
    }

    @Override
    @RequestMapping(value="/mail/secondApproverStart",method = RequestMethod.POST)
    public ObjectRestResponse secondApproverStart(){
        try {

            mailReminderBiz.secondApproverStart();
        } catch (Exception e) {
            e.printStackTrace();
            return  new ObjectRestResponse().rel(true).msg("500").data("添加失败");
        }
        return  new ObjectRestResponse().rel(true).msg("200").data("添加成功");
    }

    @Override
    @RequestMapping(value="/mail/firstApproverEnd",method = RequestMethod.POST)
    public ObjectRestResponse firstApproverEnd(){
        try {

            mailReminderBiz.firstApproverEnd();
        } catch (Exception e) {
            e.printStackTrace();
            return  new ObjectRestResponse().rel(true).msg("500").data("添加失败");
        }
        return  new ObjectRestResponse().rel(true).msg("200").data("添加成功");
    }

    @Override
    @RequestMapping(value="/mail/secondApproverEnd",method = RequestMethod.POST)
    public ObjectRestResponse secondApproverEnd(){
        try {

            mailReminderBiz.secondApproverEnd();
        } catch (Exception e) {
            e.printStackTrace();
            return  new ObjectRestResponse().rel(true).msg("500").data("添加失败");
        }
        return  new ObjectRestResponse().rel(true).msg("200").data("添加成功");
    }

    @Override
    @RequestMapping(value="/mail/thirdApprover",method = RequestMethod.POST)
    public ObjectRestResponse thirdApprover(){
        try {

            mailReminderBiz.thirdApprover();
        } catch (Exception e) {
            e.printStackTrace();
            return  new ObjectRestResponse().rel(true).msg("500").data("添加失败");
        }
        return  new ObjectRestResponse().rel(true).msg("200").data("添加成功");
    }

    @Override
    @RequestMapping(value="/mail/fourthApprover",method = RequestMethod.POST)
    public ObjectRestResponse fourthApprover(){
        try {

            mailReminderBiz.fourthApprover();
        } catch (Exception e) {
            e.printStackTrace();
            return  new ObjectRestResponse().rel(true).msg("500").data("添加失败");
        }
        return  new ObjectRestResponse().rel(true).msg("200").data("添加成功");
    }

}
